package com.itheima.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.itheima.domain.Alcount;
import com.itheima.mapper.UserMapper;
import com.itheima.service.HelloService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service(interfaceClass = HelloService.class)
public class HelloServiceImpl implements HelloService {
    @Autowired
    UserMapper userMapper;

    @Override
    public void sayHello() {
        System.out.println("85+hello world");
    }

    @Override
    public List<Alcount> findAll() {
        return userMapper.findAll();
    }

    @Transactional
    @Override
    public void transMoney(String outMan,String inMan,double balance) {
        userMapper.outMoney(outMan,balance);
        //int i=1/0;
        userMapper.inMoney(inMan,balance);
    }
}
